from django.contrib import admin
from snippets.models import ProjectType, Project, UserInfo, InvestmentAnalyse, InfoPage, InfoFolder
from django.utils.safestring import mark_safe
# 注册管理页面



@admin.register(ProjectType)
class ProjectTypeAdmin(admin.ModelAdmin):
    list_display = ('id', 'name')

@admin.register(Project)
class ProjectAdmin(admin.ModelAdmin):
    list_display = ('id', 'created', 'name', 'is_publish', 'publish_time', 'icon', 'project_type', 'intruduction', 'team')
    def icon_data(self, obj):
        return mark_safe(u'<img src="%s" width="100px" />' % obj.icon.url)
    readonly_fields = ['icon_data']
    icon_data.short_description = u'icon'

@admin.register(UserInfo)
class UserInfoTypeAdmin(admin.ModelAdmin):
    list_display = ('id', 'name')

@admin.register(InvestmentAnalyse)
class InvestmentAnalyseAdmin(admin.ModelAdmin):
    list_display = ('id',
        'title',
        'icon',
        'project',
        'is_publish',
        'publish_time',
        'author',
        'content')

@admin.register(InfoPage)
class InfoPageAdmin(admin.ModelAdmin):
    list_display = ('id',
        'created',
        'title',
        'icon',
        'info_folder',
        'project',
        'is_publish',
        'publish_time',
        'author',
        'content',
        'price',
        'ContentType',
        'content_type',
        'need_nft',
        'is_sell_limit',
        'sell_limit_count',
        'sell_count',
        'is_time_limit',
        'time_limit')

@admin.register(InfoFolder)
class InfoFolderAdmin(admin.ModelAdmin):
    list_display = ('id',
        'created',
        'user_id',
        'folder_name'
    )






    
